<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>  
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>     
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css"  href="../style/style.css" rel="stylesheet"/>
<link type="text/css" href="../../../style/theme/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../../js/jquery.js"></script>
<script type="text/javascript" src="../../../js/jquery-ui-personalized.min.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/dormSupervisor.js"></script>
<script type="text/javascript" src="../js/propertyWork.js"></script>
<title>购买列表</title>
</head>
<body>
	<div class="ajaxMessage"></div>
	<h1>${dormSupervisor.building.name }的购置列表</h1>
	<form action="purchaseList.do" method="get" name="repairDTO">
		<input type="hidden" name="building" value="${dormSupervisor.building.id }"/>	
		<div class="filterForm">
			<select name="type">
				<option value="building">楼栋</option>
				<option value="dormitory">寝室</option>
			</select>
			<span class="dormitoryInput">
				<label for="dormitoryName">寝室</label>
				<input type="text" maxlength="10" name="dormitoryName" id="dormitoryName"/>
				<span class="warning"></span>	
			</span>	
			<label for="processed">受理</label>
			<input type="checkbox" name="processed" id="processed" value="true"/>
			<label for="applied">处理</label>
			<input type="checkbox" name="applied" id="applied" value="true"/>
			<label for="fromDate">起始时间</label>
			<input type="text" name="fromDate" id="fromDate" class="datepicker"/>
			<label for="toDate">结束时间</label>
			<input type="text" name="toDate" id="toDate" class="datepicker"/>
			<input type="submit" name="submit" value="查询"/>
		</div>
	</form>
	<c:choose>
		<c:when test="${!empty purchases.list}">
			<table id="purchases" border="1px">
				<thead>
					<tr>
						<th colspan="7">购置单</th>
					</tr>
					<tr>
						<th>系统ID</th><th>寝室</th><th>原因</th><th>请求时间</th><th>受理</th><th>处理</th><th>删除</th>
					</tr>
				</thead>
				<tbody>		
					<c:forEach items="${purchases.list}" var="purchase">
						<tr>								
							<td>${purchase.id }</td>
							<td>${purchase.dormitory.name }</td>
							<td title="${purchase.description }">${purchase.description }</td>
							<td><fmt:formatDate value="${purchase.requestDate }" type="both"/></td>
							
							<td>
								状态<input type="checkbox" name="processed" 
									${purchase.status.processed ? "checked=\"checked\"" : "" } value="${purchase.id }"
									${purchase.status.applied ? "disabled=\"disabled\"" : "" }/>		
							</td>
							<td>
								状态<input type="checkbox" name="applied"
									${purchase.status.applied ? "checked=\"checked\"" : "" } value="${purchase.id }"/>
														
							</td>
							<td><button class="deleteButton" name="deletePurchase" value="${purchase.id }">删除</button></td>
						</tr>
					</c:forEach>			
				</tbody>
			</table>
		</c:when>
		<c:otherwise>
			<p>列表为空</p>
		</c:otherwise>
	</c:choose>
	<div class="confirm"><p></p></div>
	<div class="returnMessage"><p></p></div>
</body>
</html>